﻿Ext.regModel('Ranking', {
    // FIX THISS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    fields: [
        { name: 'USER_ID', type: 'integer' },
        { name: 'RESTAURANT_ID', type: 'integer' },
        { name: 'RANK', type: 'integer' },
        { name: 'HATE', type: 'integer' },
        { name: 'CRAVE', type: 'integer' }
    ],
    associations: [
        { type: 'belongsTo', model: 'User', name: 'user' },
        { type: 'belongsTo', model: 'Restaurant', name: 'restaurant' }
    ]
});

//rankingStore = new Ext.data.Store({
//    model: 'Ranking',
//    proxy: {
//        type: 'scripttag',
//        url: 'http://deals.expedia.com/beta/deals/hotels.jsonp',
//        extraParams: {

//    },
//    reader: {
//        type: 'json',
//        root: 'rankings'
//    },
//    callbackParam: 'callback'
//}
//});

//rankingStore.load();
// Then we need to iterate the store and set the id/phantom

rankingStore = new Ext.data.Store({
    model: 'Ranking',
    sorters: 'RESTAURANT_ID',
    data: [
        { "USER_ID": 1234, "RESTAURANT_ID": 4321, "RANK": 3, "HATE": 1, "CRAVE": 0 }
    ]
});